#!/bin/bash

Echo()
{
	case $1 in
	    success)  flag="\033[1;32m"
	    ;;
	    failure)  flag="\033[1;31m"
	    ;;
	    warning)  flag="\033[1;33m"
	    ;;
	    msg)  flag="\033[1;34m"
	    ;;
	    *)  flag="\033[1;34m"
	    ;;
	esac
	if [[ $LANG =~ [Uu][Tt][Ff] ]]
	then
		echo -e "${flag}${2}\033[0m"
	else
		echo -e "${flag}${2}\033[0m" | iconv -f utf-8 -t gbk
	fi
}

Main()
{
	virsh list --all
	read -p "please input ebs_name:" ebs_name
	virsh list |grep $ebs_name >/dev/null 2>&1
	[ $? -eq 0 ] && virsh destroy $ebs_name
	virsh undefine $ebs_name
	rm -rf  /vmdata/${ebs_name}/
	Echo "success" "$ebs_name删除成功"
}
